<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv=Content-Type content="text/html;charset=utf-8">
    <title>user list</title>
</head>
<body>

<h1>User测试</h1>

<form class="form-inline" th:action="@{'/user/add'}">
    <input type="submit" value="Add"/>
</form>

<table class="table table-bordered table-striped">
    <thead>
    <tr>
        <th>id</th>
        <th>username</th>
        <th>password</th>
        <th>name</th>
        <th>role</th>
    </tr>
    </thead>
    <tbody>
    <tr th:if="${userList.empty}">
        <td colspan="2">No users</td>
    </tr>
    <tr th:each="user : ${userList}">
        <td><a href="view.html" th:href="@{'/user/' + ${user.id}}" th:text="${user.id}">test username</a></td>
        <td th:text="${user.username}">test username</td>
        <td th:text="${user.password}">test pass</td>
        <td th:text="${user.name}">test name</td>
        <td><span th:each="role:${user.roleEntitySet}"><span th:text="${role.name}">test name</span>  </span></td>
        <td>
            <form class="form-inline" th:action="@{'/user/delete/' + ${user.id}}" th:method="delete">
                <input type="submit" value="Delete"/>
            </form>
        </td>
    </tr>
    </tbody>
</table>

</body>
</html>